home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Resources / Online / Miami / MiamiSDK / netinclude / sys / types.h < prev    next >
C/C++ Source or Header  |  1997-12-04  |  1KB  |  65 lines

  1. #ifndef _SYS_TYPES_H_
  2. #define    _SYS_TYPES_H_
  3.  
  4. #ifndef _MACHINE_ENDIAN_H_
  5. #include <machine/endian.h>
  6. #endif
  7.  
  8. typedef    unsigned char    u_char;
  9. typedef    unsigned short    u_short;
  10. typedef    unsigned long    u_int;
  11. typedef    unsigned long    u_long;
  12.  
  13. typedef    char *        caddr_t;    /* core address */
  14.  
  15. #ifndef _MACHINE_ANSI_H_
  16. #include <machine/ansi.h>
  17. #endif
  18.  
  19. #ifndef _MACHINE_TYPES_H_
  20. #include <machine/types.h>
  21. #endif
  22.  
  23. #ifndef _STRING_H
  24. #include <string.h>
  25. #endif
  26.  
  27. #ifdef    _BSD_SIZE_T_
  28. #ifndef _SIZE_T
  29. typedef    _BSD_SIZE_T_    size_t;
  30. #define _SIZE_T 1
  31. #endif
  32. #undef    _BSD_SIZE_T_
  33. #endif
  34.  
  35. #define    NBBY    8        /* number of bits in a byte */
  36.  
  37. /*
  38.  * Select uses bit masks of file descriptors in longs.  These macros
  39.  * manipulate such bit fields (the filesystem macros use chars).
  40.  * FD_SETSIZE may be defined by the user, but the default here should
  41.  * be enough for most uses.
  42.  */
  43. #ifndef    FD_SETSIZE
  44. #define    FD_SETSIZE    256
  45. #endif
  46.  
  47. typedef long    fd_mask;
  48. #define NFDBITS    (sizeof(fd_mask) * NBBY)    /* bits per mask */
  49.  
  50. #ifndef howmany
  51. #define    howmany(x, y)    (((x)+((y)-1))/(y))
  52. #endif
  53.  
  54. typedef    struct fd_set {
  55.     fd_mask    fds_bits[howmany(FD_SETSIZE, NFDBITS)];
  56. } fd_set;
  57.  
  58. #define    FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
  59. #define    FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
  60. #define    FD_ISSET(n, p)    ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
  61. #define    FD_COPY(f, t)    bcopy(f, t, sizeof(*(f)))
  62. #define    FD_ZERO(p)    bzero(p, sizeof(*(p)))
  63.  
  64. #endif /* !_SYS_TYPES_H_ */
  65.